<?php
include("../seguranca.php"); // Inclui o arquivo com o sistema de segurança
protegePagina(); // Chama a função que protege a página
?>
<!DOCTYPE html lang="pt-BR">
<head>    
<link href="../style/esquema.css" rel="stylesheet">
<script type="text/javascript" src="../script/script.js"></script>
<meta charset="UTF-8">
<title>Wise-Car</title>
</head>

<body>
<div align="right" class="geral">
   	<div id="content" align="center">
    <div class="logoff">
    <a href="http://localhost/wisecar/view/index.php"><input class="botaoSair" type="button" value="Home"></a>
    <a href="http://localhost/wisecar/index.php"><input class="botaoSair" type="button" value="Logoff"></a>
    </div>
    <h1>Editar Funcionário</h1>
    <?php
	$query = "select * from funcionarios,pessoas where funcionarios.Pessoas_id = pessoas.id and BINARY pessoas.Nome = '".$_SESSION['newNome']."'";
	$result = mysql_query($query);
	$row = mysql_fetch_assoc($result);
    ?>
    <form action="../controller/editarFuncionario.php" method="post">
				<table align="center" cellpadding="2" cellspacing="2">
                <tr><td>
                <input type="hidden" name="idCliente" value="<?php echo $row['id']?>">
                </td><td>Dados Antigos</td><td>Novos Dados</td></tr>
					<tr>
						<td align="left">Nome </td>
						<td><input type="text" disabled value="<?php echo $_SESSION['newNome']; ?>" ></td>
						<td><input type="hidden"  name="nome"></td>
					</tr>
					<tr>
						<td align="left">CPF</td>
						<td><input type="text" disabled value ="<?php echo $row['CPF'];?>" maxlength="14"/></td>
						<td><input type="text" name="cpf" id="Cpf" onKeyPress="return isNumber(event);" onKeyUp="return mascaraCpf(this.value);" maxlength="14"/></td>
					</tr>
					<tr>
						<td align="left">RG</td>
						<td><input type="text" value="<?php echo $row['RG'];?>" disabled maxlength="20"/></td>
						<td><input type="text"  name="rg" id="rgID" onkeypress="return isNumber(this)" maxlength="20"/></td>
					</tr>
					<tr>
						<td align="left">Usuário</td>
						<td><input type="text" disabled value="<?php echo $row['userName']; ?>"></td>
						<td><input type="text"  name="usuario" id="usuarioID"></td>
					</tr>
					<tr>
						<td align="left">Senha</td>
						<td><input type="password" disabled value="*********"></td>
						<td><input type="password" name="senha" id="senhaID"></td>
					</tr>
					<tr>
						<td align="left">Data Nascimento</td>
						<td><input type="date" disabled value="<?php echo $row['dataNascimento'];?>"></td>
						<td><input type="date" name="dataNasc" id="dataNascID"></td>
					</tr>
					<tr>
						<td align="left">E-mail:</td>
						<td><input type="email" disabled value="<?php echo $row['email'];?>"></td>
						<td><input type="email" name="email" id="emailID"></td>
					</tr>
					<tr>
						<td align="left">Telefone Fixo:</td>
						<td><input type="text" disabled value="<?php echo $row['Telefone_fixo']; ?>"></td>
						<td><input type="text" name="telFixo" onKeyPress="return isNumber(this);" id="telFixoID"></td>
					</tr>
					<tr>
						<td align="left">Celular:</td>
						<td><input type="text"  disabled value="<?php echo $row['Telefone_celular']; ?>"></td>
						<td><input type="text" name="celular" onKeyPress="return isNumber(this);" id="celularID"></td>
					</tr>
					<tr>
						<td align="left">Endereço</td>
						<td><input type="text" disabled value="<?php echo $row['Rua']; ?>"></td>
						<td><input type="text" name="endereco" id="enderecoID"></td>
					</tr>
					<tr>
						<td align="left">Data de Contratação:</td>
						<td><input type="date" disabled value="<?php echo $row['Data_de_Contrato']; ?>"></td>
						<td><input type="date"  name="dataContratacao" id="dataContratacaoID"></td>
					</tr>
					<tr>
						<td>Tipo de perfil</td>
						<td align="left">
							<select disabled>
								<option <?php if ($row['Perfis_id'] == 1) echo 'selected';?> value="1">Gerente</option>
								<option <?php if ($row['Perfis_id'] == 2) echo 'selected';?> value="2">Funcionário</option>
							</select>
						</td>
						<td>
							<select name="perfil_id" id="tipoID">
								<option value=""></option>
								<option <?php if ($row['Perfis_id'] == 1) echo 'selected';?> value="1">Gerente</option>
								<option <?php if ($row['Perfis_id'] == 2) echo 'selected';?> value="2">Funcionário</option>
							</select>
						</td>
					</tr>
					<tr><td colspan="3" align="center">
							<input type="submit" value="Enviar">
							<input type="reset" value="Limpar">
						</td></tr>		
				</table>
			</form>
    </div>
</div>
</body>
</html>